import {
  comments
} from "../../../../js/modules/mall.js";
import {
  orderlist
} from "../../../../js/modules/order.js"
import {
  storage,
  util,
  dialog,
  api
} from '../../../../js/util';
import {
  router
} from '../../../../js/router';
import authorize from '../../../../js/modules/authorize.js'
import {
  upload
} from '../../../../js/modules/material.js'
const app = getApp()
import BasePage from '../../../../js/common/base-page'
BasePage({
  pageKey:"center",

  /**
   * 页面的初始数据
   */
  data: {
    imgDomain: api.imgDomain,
    enableOss: api.enableOss,
    commentInfo:{},   
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.data.id=options.id||0;
    this.data.fkId = app.dns.proprietorId;
    this.data.fkFlag = app.dns.proprietor;
    this.getDetail();
  },
  getDetail:function(){
    var that=this;
    comments.getDetail({id:this.data.id,fkFlag:this.data.fkFlag}, function (content){
      that.setData({
        commentInfo:content
      })
    });
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  /**
   * 点击看大图
   */
  imgYu:function(event){
    var src = event.currentTarget.dataset.src;
    var imgList = event.currentTarget.dataset.list;//获取data-list
    var imgSrl = [];
    for (var i = 0; i < imgList.length; i++) {
      imgSrl[i] = this.data.imgDomain + imgList[i].VirtualPath;
    }
    //图片预览
    wx.previewImage({
      current: src, // 当前显示图片的http链接
      urls: imgSrl // 需要预览的图片http链接列表
    })
  }
})